<template>
  <div class="login-wrap">
    <div id="mbox">
      <div id="logoDiv">
        <img id="logoImg" src="../assets/logo/logo_g.png" />
        <img id="l_title" src="../assets/logo/l_title2_g.png" />
      </div>
      <br />
      <div class="ms-login">
        <el-form :model="param" ref="login" label-width="0px" class="ms-content">
          <el-form-item prop="username">
            <el-input v-model="param.username" placeholder="账户" @keyup.enter.native="submitForm"></el-input>
          </el-form-item>
          <el-form-item prop="password">
<<<<<<< HEAD
            <el-input type="password" placeholder="密码" v-model="param.password" @keyup.enter.native="submitForm"></el-input>
=======
            <el-input
                type="password"
                placeholder="密码"
                v-model="param.password"
                @keyup.enter.native="submitForm"
            ></el-input>
>>>>>>> 960f9f5... 修改了按钮大小，增加了表单内容的显式
          </el-form-item>
          <div class="login-btn">
            <el-button type="primary" @click="submitForm">登录</el-button>
          </div>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data: function() {
    return {
      param: {
        username: "admin",
        password: "123123"
      }
    };
  },
  methods: {
    submitForm() {
      if (this.param.username == "" || this.param.password == "") {
        this.$message.error({
          message: "用户名及密码不能为空",
          center: true,
          duration: 2000
        });
        return false;
      }
      this.$axios
          .post(this.$api.user.userLogin, {
            userNm: this.param.username,
            userPwd: this.param.password
          })
          .then(res => {
            if (res.data.data == "登录成功") {
              this.$message.success("登录成功");
              localStorage.setItem("isLogin", true);
              this.$router.push("home");
            } else {
              this.$message.error({
                message: res.data.data,
                center: true,
                duration: 2000
              });
              return false;
            }
          })
          .catch(err => {
            console.log(err);
            this.$message.error({
              message: "请求出错，请联系管理员",
              center: true,
              duration: 2000
            });
            return false;
          });
<<<<<<< HEAD
          return false;
        });
     }
=======
    }
>>>>>>> 960f9f5... 修改了按钮大小，增加了表单内容的显式
  }
};
</script>

<style scoped>
@import "../assets/css/main.css";

.login-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  background-image: url(../assets/img/login-bg.jpg);
  background-size: 100%;
}
.ms-title {
  width: 100%;
  line-height: 50px;
  text-align: center;
  font-size: 20px;
  color: #fff;
  border-bottom: 1px solid #ddd;
}
.ms-login {
  width: 350px;
  height: 220px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.3);
  margin: 0 auto;
}
.ms-content {
  padding: 30px 30px;
}
.login-btn {
  text-align: center;
}
.login-btn button {
  width: 100%;
  height: 36px;
  margin-bottom: 10px;
}
.login-tips {
  font-size: 12px;
  line-height: 30px;
  color: #fff;
}

#mbox {
  height: 370px;
  width: 700px;
  position: absolute;
  margin: auto;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

#logoDiv {
  height: 70px;
  line-height: 70px;
  width: 600px;
  margin-bottom: 70px;
  margin: 0 auto;
}

#logoImg,
#l_title {
  width: auto;
  -webkit-user-drag: none;
}

#logoImg {
  height: 40px;
  position: relative;
  top: -15px;
}

#l_title {
  height: 70px;
}
</style>

